import { Navigate } from "react-router-dom"
const routes = [
  {
    path: "/error-page",
    async lazy() {
      const res = await import("../pages/error-page/index.tsx")
      return {
        Component: res.default,
      }
    },
    children: [
      {
        path: "/error-page/404",
        async lazy() {
          const res = await import("../pages/error-page/404/index.tsx")
          return {
            Component: res.default,
          }
        },
      },
    ],
  },
  {
    path: "/layout",
    async lazy() {
      const res = await import("../pages/layouts/index.tsx")
      return {
        Component: res.default,
      }
    },
    children: [
      {
        path: "token-manager",
        index: true,
        async lazy() {
          const res = await import("../pages/tokenManager/index.tsx")
          return {
            Component: res.default,
          }
        },
      },
      {
        path: "token-manager/detail",
        async lazy() {
          const res = await import("../pages/tokenManager/detail/index.tsx")
          return {
            Component: res.default,
          }
        },
      },
      {
        path: "task-manager",
        index: true,
        async lazy() {
          const res = await import("../pages/taskManager/index.tsx")
          return {
            Component: res.default,
          }
        },
      },
    ],

  },
  {
    index: true,
    element: <Navigate to={{ pathname: "/layout/token-manager", search: location.search }} />,
  },
]
export default routes
